<template>
  <div class="app-login">
    <div class="container card p-4">
      <div class="h3">政银担协同平台</div>
      <div class="text-primary">统一登录中心</div>

      <div>
        <hr />
        <div
          v-for="link in loginLinks"
          :key="link.label"
          class="rounded item-bar my-3 p-2"
          :style="{ backgroundColor: link.bgColor }"
          @click="go(link)"
        >
          {{ link.label }}
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { loginLinks } from '@/nd/plugins/enum'

export default {
  components: {},
  props: {},
  data() {
    return {
      loginLinks,
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    go({ type }) {
      if (type === -1) {
        return this.goToProvince()
      }

      this.goToLogin(type)
    },
    goToProvince() {
      location.href =
        location.host.includes('vimihome') || location.host.includes('61.243.3.248')
          ? 'http://36.7.159.60:8881/admin/login'
          : 'https://gznyxd.com/admin/login'
    },
    goToLogin(type) {
      this.$router.push({
        path: '/login/form',
        query: {
          type,
        },
      })
    },
  },
}
</script>

<style lang="scss" scoped>
.item-bar {
  color: white;
  font-size: 1.3rem;
  &:hover {
    cursor: pointer;
  }
}
</style>
